@extends('admin/layout.app')

@section('title', '添加菜单')

@section('content')
    @if (count($errors) > 0)
        <div class="col-lg-9">
            <div class="alert alert-danger">
                <ul>
                    @if(is_object($errors))
                        @foreach($errors->all() as $error)
                            <li>{{$error}}</li>
                        @endforeach
                    @else
                        <li>{{$errors}}</li>
                    @endif
                </ul>
            </div>
        </div>
    @endif
    <div class="col-lg-10">
        <form class="form-horizontal" action="/admin/menu" method="post">
            {{csrf_field()}}
            <div class="form-group">
                <label for="inputPassword3" class="col-sm-2 control-label">上级</label>
                <div class="col-sm-8">
                    <select class="form-control" name="parent_id">
                        <option value="0">作为一级菜单</option>
                        @if($menu_list)
                            @foreach($menu_list as $item)
                                <option value="{{$item['id']}}">{{ str_repeat('&nbsp;&nbsp;|--',$item['level']).$item['name'] }}</option>
                            @endforeach
                        @endif
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label for="input-name" class="col-sm-2 control-label">菜单名称</label>
                <div class="col-sm-8">
                    <input type="text" name="name" class="form-control" id="input-name" placeholder="菜单名称"
                           value="">
                </div>
            </div>
            <div class="form-group">
                <label for="input-url" class="col-sm-2 control-label">链接地址</label>
                <div class="col-sm-8">
                    <input type="text" name="url" class="form-control" id="input-url" placeholder="链接地址,父级菜单不需要填写"
                           value="">
                </div>
            </div>
            <div class="form-group">
                <label for="input-route" class="col-sm-2 control-label">路由名称</label>
                <div class="col-sm-8">
                    <input type="text" name="route_name" class="form-control" id="input-route" placeholder="路由名称，开发人员填入"
                           value="">
                </div>
            </div>
            <div class="form-group">
                <label for="input-remark" class="col-sm-2 control-label">备注</label>
                <div class="col-sm-8">
                    <textarea class="form-control" name="remark"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label for="input-status" class="col-sm-2 control-label">状态</label>
                <div class="col-sm-8">
                    <p class="pt6pr12">
                        <input id="input-status-1" type="radio" name="status"
                               value="1" checked/> <label
                                for="input-status-1">正常</label>
                        <input id="input-status-2" type="radio" name="status"
                               value="2"/> <label
                                for="input-status-2">禁用</label>
                    </p>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-3 col-sm-10">
                    <button type="submit" class="btn btn-default">保存</button>
                </div>
            </div>
        </form>
    </div>
@endsection
